jClass = {
    initData() {
        this.loadFont();
        window.onresize=this.loadFont;
        this.init()
        this.bindEvent();
    },
    loadFont(){
        var widthScreen = $(window).width();
        var nowFont=widthScreen/1920*15;
        var htmlFont=document.getElementsByTagName('html')[0];
        htmlFont.style.fontSize =nowFont+"px";
        htmlFont.style.lineHeight =nowFont+"px";
    },
    init() {
        //年月日范围
        $('.J-datepickerTime-single').datePicker({
            format: 'YYYY-MM-DD HH:mm'
        });

        $("#jTabContainer").load("file/information/ruleManagement/cgtab.html");
    },
    bindEvent() {
        $("#jTable2").hide()
        let self = this
        $("#jtab ul li").click(function(){
            let index=$(this).index();
            // console.log(index)
            if (index===0) {
                $("#jTable2").hide()
            } else {
                $("#jTable2").show()
            }
            $(this).addClass("active").siblings("li").removeClass("active");
            var sId = $(this).data("href");
            self.loadInner(sId);
        })
    },
    loadInner(sId){
        console.log(sId)
        var path, index;
        switch(sId) {
            case "cgtab":
                path = "file/information/ruleManagement/cgtab.html";
                break;
            case "driverlinetab":
                path = "file/information/ruleManagement/driverlinetab.html";
                break;
            case "autodbtab":
                path = "file/information/ruleManagement/autodbtab.html";
                break;
            case "autocgtab":
                path = "file/information/ruleManagement/autocgtab.html";
                break;
            case "autogettab":
                path = "file/information/ruleManagement/autogettab.html";
                break;
            case "stoptimetab":
                path = "file/information/ruleManagement/stoptimetab.html";
                break;
            case "ruleManagetab":
                path = "file/information/ruleManagement/ruleManage.html";
                break;
        }
        $("#jTabContainer").load(path);
    },
}
$(function() {
    jClass.initData()

    let datareaslut2 = []
    datareaslut2.push({
        "id": 1,
        "type": Math.floor(Math.random() * 10) % 2 == 0 ? "1" : "0",
        "carPi": "陕A" + Math.floor(Math.random() * 89999 + 10000),
        "owner": "张三" + Math.floor(Math.random() * 89999 + 10000),
        "colorValue": Math.floor(Math.random() * 10) % 3,
        "hfsj":"2019-06-29 16:58:46",
        "tongdao":"已处理",
        "wenjian":Math.floor(Math.random() * 100) % 20+"km/h",
        "lshfsj":"2019-06-29 16:58:46",
        "lxsc":Math.floor(Math.random() * 1000) % 60+"分钟",
        "caozuo":"获取证据"
    })
    $('#cnf_reportTable2').bootstrapTable({
        method: 'get',
        cache: false,
        height: 250,
        pagination: false,
        pageSize: 5,
        pageNumber:1,
        showColumns: false,
        striped: true,
        columns: [{
            field: 'id',
            title: '序号'
        },
            {
                field: 'hfsj',
                title: '报警时间',
                visible: false
            },
            {
                field: 'carPi',
                title: '车牌号码'
            },
            {
                field: 'tongdao',
                title: '报警处理状态',
            },
            {
                field: 'wenjian',
                title: '报警速度',
            },
            {
                field: 'lshfsj',
                title: '报警处理时间',
            },
            {
                field: 'lxsc',
                title: '延迟处理时长',
            },
            {
                field: 'caozuo',
                title: '操作',
            },

        ],
        data :datareaslut2,
        onPageChange: function (size, number) {

        },
        formatNoMatches: function(){
            return '无符合条件的记录';
        }
    });

    var datareaslut = [];
    for (var i = 0; i < 100; i++) {
        num = Math.floor(Math.random() * 10);
        tlat = 108.939621 + Math.random() * 10 - 5;
        tlng = 34.343147 + Math.random() * 10 - 5;
        datareaslut.push({
            "id": i+1,
            "type": num % 2 == 0 ? "1" : "0",
            "position": [tlat, tlng],
            "carPi": "陕A" + Math.floor(Math.random() * 89999 + 10000),
            "owner": "张三" + Math.floor(Math.random() * 89999 + 10000),
            "colorValue": Math.floor(Math.random() * 10) % 3,
            "hfsj":"2019-06-29 16:58:46",
            "tongdao":"已处理",
            "wenjian":Math.floor(Math.random() * 100) % 20+"km/h",
            "lshfsj":"2019-06-29 16:58:46",
            "lxsc":Math.floor(Math.random() * 1000) % 60+"分钟",
            "caozuo":"获取证据"
        })
    };
    var height=$(".cn_containner").height()-200;
    $('#cnf_reportTable').bootstrapTable({
        method: 'get',
        cache: false,
        height: 400,
        pagination: true,
        pageSize: 10,
        pageNumber:1,
        showColumns: true,
        striped: true,
        columns: [{
            field: 'id',
            title: '序号'
        },
            {
                field: 'hfsj',
                title: '报警时间',
                visible: false
            },
            {
                field: 'carPi',
                title: '车牌号码'
            },
            {
                field: 'tongdao',
                title: '报警处理状态',
            },
            {
                field: 'wenjian',
                title: '报警速度',
            },
            {
                field: 'lshfsj',
                title: '报警处理时间',
            },
            {
                field: 'lxsc',
                title: '延迟处理时长',
            },
            {
                field: 'caozuo',
                title: '操作',
            },

        ],
        data :datareaslut,
        onPageChange: function (size, number) {

        },
        formatNoMatches: function(){
            return '无符合条件的记录';
        }
    });

})



















